Removing object/array difference from different arrays [duplicate]

Posted by Kay Singian on Stack Overflow See other posts from Stack Overflow or by Kay Singian
Published on 2013-09-24T15:08:51Z Indexed on 2014/06/10 15:24 UTC
Read the original article Hit count: 103

Filed under:
|
|

This question already has an answer here:

I have two JavaScript objects:

object_1 = [
    {'value': '9:00', 'text':'9:00 am', 'eventtime':'09:00:00' },
    {'value': '9:30', 'text':'9:30 am', 'eventtime':'09:30:00' },
    {'value': '10:00', 'text':'10:00 am', 'eventtime':'10:00:00' },
    {'value': '10:30', 'text':'10:30 am', 'eventtime':'10:30:00' },
    {'value': '11:00', 'text':'11:00 am', 'eventtime':'11:00:00' },
    {'value': '11:30', 'text':'11:30 am', 'eventtime':'11:30:00' },
];
object_2 = [
    {'eventtime': '10:30:00'},
    {'eventtime': '11:00:00'}
];

I want to remove the object in object_1 which has the same eventtime value and store it in a new array/object . Please help me do so, I cant find a solution to this.

This will be the new array/object:

object_new = [

    {'value': '9:00', 'text':'9:00 am', 'eventtime':'09:00:00' },
    {'value': '9:30', 'text':'9:30 am', 'eventtime':'09:30:00' },
    {'value': '10:00', 'text':'10:00 am', 'eventtime':'10:00:00' },
    {'value': '11:30', 'text':'11:30 am', 'eventtime':'11:30:00' },
];

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery